import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  runtimeCompiler: true,
  plugins: [vue()],
  server: {
    proxy: { 
      '/api': {
        target: 'http://127.0.0.1:8080',  //你要跨域访问的网址
        changeOrigin: true,   // 允许跨域
        rewrite: (path) => path.replace(/^\/api/, '')     // 重写路径把路径变成空字符
      },
    },
  },
  resolve: {
    alias: [
      {
        find: '@antv/x6',
        replacement: '@antv/x6/lib'
       },
      {
         find: '@antv/x6-vue-shape',
         replacement: '@antv/x6-vue-shape/lib',
       },
   ]
 },
})
